# 异常传递
def funa():
    return 1 / 0

def funb():
    return funa()

try:
    print(funb())
except Exception as e:
    print("error: {}",e) # error: {} division by zero



# 主动抛出异常
def valid_pwd(pwd):
    if(len(pwd) <= 6):
        raise Exception("len <= 6")
    return True

try:
    valid_pwd("1234")
except Exception as e:
    print(e) # len <= 6
